# Makefile for kh-shell for Linux

VERSION		= 1.0.1
AUTHOR		= Kong
PROJECT_NAME	= kh-shell
APP_FOLDER	= build

CC	=  gcc
LD	=  $(CC)
LDFLAGS	= 
LDFLAGS	+= -lxml2

CFLAGS = -I"/usr/include/libxml2"
#CFLAGS += -DDEBUG -Wall -std=c99
CFLAGS += -DDEBUG -Wall
CFLAGS += -DVERSION='"$(VERSION)"' -DAUTHOR='"$(AUTHOR)"'
CFLAGS += -DPROJECT_NAME='"$(PROJECT_NAME)"'

SRC_DIR	= .
#RES_DIR=
OBJS	= $(patsubst %.c,%.o,$(wildcard $(SRC_DIR)/*.c))
#RESOURCES= $(wildcard $(RES_DIR)/*)

all:	dist

$(PROJECT_NAME):	$(OBJS)
	$(LD) $(LDFLAGS) -o $@ $^

%.o:	%.c
	$(CC) -c $(CFLAGS) $< -o $@

dist:	$(PROJECT_NAME)
	/bin/rm -rf $(APP_FOLDER)
	/bin/mkdir -p $(APP_FOLDER)
	@#cp $(RES_DIR)/* $(APP_FOLDER)
	cp $(PROJECT_NAME) $(APP_FOLDER)
clean:
	@rm -rf $(APP_FOLDER)
	@rm -f $(PROJECT_NAME)
	@rm -f $(SRC_DIR)/*.o
